home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / T / Thinkcup.cpt / TCL Update / TCL Update Diffs / CDecorator.c.Diff < prev    next >
Encoding:
Text File  |  1990-02-27  |  4.0 KB  |  83 lines  |  [TEXT/MPS ]

  1. File #1: Roy G. Biv:C TCL patch ƒ:new files:CDecorator.c
  2. File #2: Roy G. Biv:C TCL patch ƒ:old files:CDecorator.c
  3.  
  4. Nonmatching lines (File "Roy G. Biv:C TCL patch ƒ:new files:CDecorator.c"; Line 80:82; File "Roy G. Biv:C TCL patch ƒ:old files:CDecorator.c"; Line 80)
  5.   80        /* Altered by TCL Weaver version 1.0 (2/21/90) */
  6.   81        
  7.   82        register WindowPeek macWPeek;       /* Toolbox Window Record            */
  8.  
  9.   80        register GrafPtr    macPort;        /* Toolbox Graf Port                */
  10.  
  11.  
  12. Nonmatching lines (File "Roy G. Biv:C TCL patch ƒ:new files:CDecorator.c"; Line 85:136; File "Roy G. Biv:C TCL patch ƒ:old files:CDecorator.c"; Line 83:96)
  13.   85        Rect                structRect;     /* Bounds of window's strucRgn      */
  14.   86        Point               portTopLeft;    /* Top left of window's portRect    */
  15.   87        GrafPtr             savePort;       /* Need to save and restore port    */
  16.   88        
  17.   89        /* Center the structure region of the window on the main    */
  18.   90        /* screen, which is defined by screenBits.bounds.           */
  19.   91        
  20.   92        macWPeek = (WindowPeek) theWindow->GetMacPort();
  21.   93        
  22.   94                                            /* strucRgn gives the overall size  */
  23.   95                                            /* of a window                      */
  24.   96        if (theWindow->IsVisible()) {
  25.   97            structRect = (**(macWPeek->strucRgn)).rgnBBox;
  26.   98        }
  27.   99        else {
  28.  100                /* For invisible windows, the strucRgn is always empty.         */
  29.  101                /* Thus, we have to fool the window manager by moving the       */
  30.  102                /* window offscreen, showing it (it won't actually get          */
  31.  103                /* drawn since it's offscreen), copying the bounds of the       */
  32.  104                /* strucRgn, then hiding the window                             */
  33.  105                
  34.  106            theWindow->MoveOffScreen();
  35.  107            ShowWindow(macWPeek);
  36.  108            structRect = (**(macWPeek->strucRgn)).rgnBBox;
  37.  109            HideWindow(macWPeek);
  38.  110        }
  39.  111        
  40.  112            /* Now we need to get the top left corner of the portRect in        */
  41.  113            /* global coords, since the strucRgn is in global coords.  We       */
  42.  114            /* want to know how far the portRect is inset from the strucRgn     */
  43.  115            /* because the MoveWindow trap operates on the portRect, not the    */
  44.  116            /* strucRgn.                                                        */
  45.  117            
  46.  118        GetPort(&savePort);
  47.  119        SetPort(macWPeek);
  48.  120        portTopLeft = topLeft(((GrafPtr) macWPeek)->portRect);
  49.  121        LocalToGlobal(&portTopLeft);
  50.  122        SetPort(savePort);
  51.  123        
  52.  124            /* Finally, we have all the necessary information.                  */
  53.  125            
  54.  126        hPos = screenBits.bounds.left + portTopLeft.h - structRect.left +
  55.  127                ( (screenBits.bounds.right - screenBits.bounds.left) -
  56.  128                  (structRect.right - structRect.left) ) / 2;
  57.  129                  
  58.  130            /* Vertically, we have to account for the menu bar.                 */
  59.  131            
  60.  132        vPos = screenBits.bounds.top + GetMBarHeight() / 2 +
  61.  133                portTopLeft.v - structRect.top +
  62.  134                ( (screenBits.bounds.bottom - screenBits.bounds.top) -
  63.  135                  (structRect.bottom - structRect.top) ) / 2;
  64.  136    
  65.  
  66.   83    
  67.   84            /* Center the port rectangle of the window on the main screen,  */
  68.   85            /* which is defined by screenBits.bounds.                       */
  69.   86            
  70.   87        macPort = theWindow->GetMacPort();
  71.   88        
  72.   89        hPos = screenBits.bounds.left +
  73.   90                ( (screenBits.bounds.right - screenBits.bounds.left) -
  74.   91                  (macPort->portRect.right - macPort->portRect.left) ) / 2;
  75.   92                  
  76.   93        vPos = screenBits.bounds.top +
  77.   94                ( (screenBits.bounds.bottom - screenBits.bounds.top) -
  78.   95                  (macPort->portRect.bottom - macPort->portRect.top) ) / 2;
  79.   96        
  80.  
  81.  
  82. *** EOF on both files at the same time ***
  83.